package com.example.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.service.AuthorsService;

import lombok.RequiredArgsConstructor;

/**
 * @author : guorf
 * @version : v1.0
 * @description : TODO
 * @createTime : 2023/5/6 9:51
 */
@RestController
@RequestMapping("download")
@RequiredArgsConstructor
public class HelloController {

    private final AuthorsService authorsService;

    /**
     * @description TODO 流式导出
     * @param response
     **/
    @GetMapping("streamDownload")
    public void streamDownload(HttpServletResponse response)
            throws IOException {
        authorsService.streamDownload(response);
    }

    /**
     * @description TODO 普通导出
     * @param response
     **/
    @GetMapping("traditionDownload")
    public void traditionDownload(HttpServletResponse response)
            throws IOException {
        authorsService.traditionDownload (response);
    }
}
